<template>
  <RouterLink class="product-item" :to="href">
    <img :src="src" alt="" srcset="" />
    <div class="title">{{ title }}</div>
    <div class="description">{{ description }}</div>
    <div class="price">￥{{ price }}</div>
  </RouterLink>
</template>

<script lang="ts" setup>
import { RouterLink } from "vue-router";

defineProps<{
  src: string;
  href: string;
  title: string;
  description: string;
  price: number;
}>();
</script>

<style lang="less" scoped>
.product-item {
  font-size: calc(10px + 1vw / 2);
  padding: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;

  img {
    width: 70%;
  }

  .title {
    font-weight: bold;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .description {
    text-align: center;
    width: 70%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .price {
    color: red;
  }
}
</style>
